<template>
	<view class="mine">
		<scroll-view scroll-y="true" class="scrollView">
			<uni-forms ref="masterEnterForm" :modelValue="FormData" :rules="rules" label-position="top"
				label-width="500rpx">
				<uni-forms-item label="标题" name="deviceName">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.deviceName" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="内容" name="otherContent">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.otherContent" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="备注" name="remark">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.remark" />
					<view class="line"></view>
				</uni-forms-item>
				<!-- <uni-forms-item label="其他需要填写内容" name="skills">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"  v-model="FormData.name"/>
					<view class="line"></view>
				</uni-forms-item> -->
				<uni-forms-item label="图片上传" name="picture">
					<you-upload :maxCount="6" @changeFile="changeFile"></you-upload>
				</uni-forms-item>
			</uni-forms>
		</scroll-view>

		<you-bottom-btn :btnConfig="bottomBtnConfig" @formSubmit="formSubmit">
		</you-bottom-btn>
	</view>
	</view>
</template>

<script>
	import {
		uploadFilePromise
	} from "@/utils/index.js"
	import Mine from "@/api/mine.js"
	export default {
		data() {
			return {
				bottomBtnConfig: [{
					text: '	保存',
					class: 'confirm',
					funcName: 'formSubmit'
				}],
				FormData: {
					picture: "",
					deviceName: "",
					otherContent: "",
					remark:''
				},
				entInfo: {}
			}
		},
		onLoad(e) {
			console.log(e);
			this.entInfo = e
		},
		methods: {
			tabClick(e) {
				console.log(e);
				this.activeName = e;
			},
			changeFile(e) {
				this.$set(this.FormData, "picture", e);
			},
			async formSubmit() {
				let res = await Mine.addElecSafety({
					...this.FormData,
					enterpriseId:this.entInfo.entAuthId,
					maintainCompanyId:this.entInfo.maintainCompanyId
				});
				setTimeout(() => {
					uni.navigateBack()
				}, 1000)

			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.placeholder-class {
		font-size: 32rpx;
		color: $main-font-auxiliary;
		line-height: 1;
	}

	.mine {
		background: #F6F8FA;
		width: 100vw;
		height: 100vh;
		box-sizing: border-box;
		padding: 0 28rpx;
		background: #fff;
	}

	.scrollView {
		height: 100vh;
		box-sizing: border-box;
		padding-bottom: var(env(safe-area-inset-bottom) + 64px);

		.upload-after {
			background: #F6F8FA;
			width: 198rpx;
			height: 198rpx;
			line-height: 1;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.line {
			opacity: 0.1;
			height: 2rpx;
			background: #000;
			margin-top: 20rpx;
		}
	}
</style>